package com.testmanager.testmananger.shuiyou.strCompare.mapper;

import com.testmanager.testmananger.shuiyou.strCompare.domain.SyCompareDetailResultEntity;
import com.testmanager.testmananger.shuiyou.strCompare.domain.SyCompareResultEntity;
import com.testmanager.testmananger.shuiyou.strCompare.dto.CompareResultDto;

import java.util.List;

public class CompareResultMapper {

    public static SyCompareResultEntity toResultEntity(CompareResultDto resultDto){
        return  new SyCompareResultEntity()
                .setId(resultDto.getId())
                .setDiffCount(resultDto.getDiffCount())
                .setCompareTaskid(resultDto.getCompareTaskid())
                .setDestTotal(resultDto.getDestTotal())
                .setSrcTotal(resultDto.getSrcTotal())
                .setIsSuccess(resultDto.getIsSuccess())
                .setComment(resultDto.getComment())
                ;
    }

    public static CompareResultDto  toResultDto(SyCompareResultEntity resultEntity, List<SyCompareDetailResultEntity> detailResultEntities){
        return  new CompareResultDto()
                .setDiffCount(resultEntity.getDiffCount())
                .setId(resultEntity.getId())
                .setSrcTotal(resultEntity.getSrcTotal())
                .setDestTotal(resultEntity.getDestTotal())
                .setCompareTaskid(resultEntity.getCompareTaskid())
                .setIsSuccess(resultEntity.getIsSuccess())
                .setDetailResultEntities(detailResultEntities)
                .setComment(resultEntity.getComment());
    }

}
